package com.dxx.cloud.admin.controller.toc;

import com.dxx.cloud.admin.constant.CommonConst;
import com.dxx.cloud.admin.module.entity.CustomerBusinessCooperation;
import com.dxx.cloud.admin.service.ICustomerBusinessCooperationService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.dromara.common.core.domain.R;
import org.springframework.util.Assert;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 37048
 */
@RestController
@RequestMapping(CommonConst.RouterPath.TOC + "/customerBusinessCooperation")
@Tag(name = "商务合作模块")
public class TocCustomerBusinessCooperationController {

    @Resource
    private ICustomerBusinessCooperationService customerBusinessCooperationService;

    @Operation(summary = "添加商务合作")
    @PostMapping("/add")
    public R<Boolean> add(@RequestBody @Validated CustomerBusinessCooperation request) {
        Assert.notNull(request.getRole(), "想成为的角色不能为空");
        Assert.notNull(request.getPhone(), "手机号不能为空");
        return R.ok(customerBusinessCooperationService.save(request));
    }
}
